﻿#pragma once


#include <QDialog>
#include <QPushButton>
#include "QListView"
#include "QStringListModel"
#include "QFileDialog"
#include "QMessageBox"
#include "QApplication"
#include "QVBoxLayout"
#include <QDesktopWidget>
#include <QLibrary>
#include <QApplication>
#include <QLabel>
#include <QComboBox>
#include "QListView"
#include "QStringListModel"
#include "QLineEdit"
#include "QSpinBox"
#include "QRadioButton"
#include <QSettings>

#include "commonfunction.h"



using namespace std;

#include "qt_graphics_view.h"

#include "dl_3.h"
#include "qwidget_tableview.h"





class Detection_dl :public QDialog
{
public:


    QSettings* m_qsettings;
    QString m_section   = "";
    AIDll* m_dl=nullptr ;
	bool m_state = false;
     
    QtQGraphicsView* m_view ;

    QPushButton* m_pushbutton_open_model;
    QLabel     * m_qlabel_model_path;
    QString RetrainedModelFileName = "";


    QPushButton* m_pushbutton_show_orign_image;
    QPushButton* m_pushbutton_detection;
    QPushButton* m_pushbutton_save_parameter;
    QPushButton* m_pushbutton_return;

    QLabel* m_qlabel_message;

    int m_result;

    
    int ret, message;

    int m_size_error_now;

    Mat m_image;
	vector<DefectResult> result_defect;
    Mat m_show_image;
    
    QWidgetTableView* m_qwidget_tableview = nullptr;
	vector<DefectStandard> m_vector_defect_standard;

public:
    explicit Detection_dl(QDialog *parent = nullptr, QSettings* qsettings = nullptr,QString section="") ;
    ~Detection_dl() ;
    virtual void detectionImage();
    int detection(Mat image, QString& message);
	void draw(Mat image_in,Mat& image_out);
    virtual void loadParameter();
    virtual void saveParameter();
    virtual bool showDialog();
    void loadmodel();
	void save_detection_standard_widgrt(QWidgetTableView* roi_sqllite, vector<DefectStandard>& vector_defect_standard);
};
#pragma execution_character_set("utf-8")
